/**************************************************
 * File: Tests.cpp                                *
 *                                                *
 *                                                *
 **************************************************/

#include "Tests.h"

void BST_Test (void)
{
	BST<int> TestTree;
	int Value;

	srand((unsigned)time(NULL));

	for (int i = 0; i < 100; i++)
	{
		TestTree.Insert(rand() % 100);
	}

	std::cout << "TestTree contains " << TestTree.GetNumberOfNodes() << " nodes" << std::endl;
	std::cout << "     The Minimum Value is: " << TestTree.FindMin() << std::endl;
	std::cout << "     The Maximum Value is: " << TestTree.FindMax() << std::endl << std::endl;

	for (int i = 0; i < 50; i++)
	{
		Value = rand() % 100;
		if (TestTree.Contains(Value))
		{
			std::cout << "TestTree DOES     contain " << Value << std::endl;
			TestTree.Remove(Value);
			std::cout << "     Removed " << Value << std::endl;
			std::cout << "     TestTree contains " << TestTree.GetNumberOfNodes() << " nodes\n" << std::endl;
		}
		else
		{
			std::cout << "TestTree DOES NOT contain " << Value << std::endl;
			std::cout << "     TestTree contains " << TestTree.GetNumberOfNodes() << " nodes\n" << std::endl;
		}
	}

	TestTree.MakeEmpty();
	std::cout << "TestTree contains " << TestTree.GetNumberOfNodes() << " nodes\n" << std::endl;
}

void List_Test (void)
{
	List<int> TestList;

	srand((unsigned)time(NULL));

	for (int i = 0; i < 100; i++)
	{
		TestList.InsertInOrder(rand() % 100);
	}

	cout << "TestList contains " << TestList.GetNumberOfNodes() << " nodes" << endl;

	TestList.MakeEmpty();

	cout << "TestList contains " << TestList.GetNumberOfNodes() << " nodes" << endl;
}